package com.wangzh.regex;

public class Demo5 {
    public static void main(String[] args) {
        String str = "我要学学编编编程程程程程程";

        String s = str.replaceAll("(.)\\1+", "$1");
        System.out.println(s);


        String str1="2021-02-01";

        int i = str1.indexOf("-");
        System.out.println(i);
        int i1 = str1.lastIndexOf("-");
        System.out.println(i1);
    }
}
